home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 130_01 / ry.h < prev    next >
Text File  |  1985-03-09  |  2KB  |  46 lines

  1. /*
  2.     this is the structure that controls the show. such a structure
  3.     must be declared for each file in main. also, very important,
  4.     be sure to include an initialization of _allocp = NULL; in
  5.     main() before doing anything else.
  6.     it is also necessary to set _blksiz of '_file' in main if
  7.     you will be using the bseek(), btell() functions. they allow
  8.     easy random access when using records of equal size.
  9. */
  10.  
  11. #define RFILE struct _file
  12.  
  13. struct _file {
  14.     int _rfd;            /* file descripter */
  15.     int _secs;            /* # of sectors in buffer */
  16.     unsigned _frstsec;    /* first sector in buffer */
  17.     unsigned _cursec;    /* cp/m current random sec */
  18.     char _curbyt;        /* current random char */
  19.     char *_nxtbyt;        /* next byte to be processed */
  20.     char *_bufbase;        /* location of base */
  21.     char *_pastbuf;        /* first byte beyond end of buffer */
  22.     char _mode;            /* read, write, append, or direct */
  23.     int _update;        /* buffer modified flag */
  24.     unsigned _curblk;    /* currently addressed block */
  25.     int _blksiz;        /* size of a logical block */
  26. };
  27.  
  28. struct _file_ptr {
  29.     unsigned _sector;
  30.     char _byt;
  31. };
  32.  
  33. #define BSFILE struct _bs
  34.  
  35. struct _bs {
  36.     RFILE *_dfp;                        /* fp to 'data_file' */
  37.     char _pfname[15];                    /* name  of ptr file */
  38.     int (*_key_comp)();                    /* pointer to appropriate comp funct */
  39.     int _data_num;                        /* number of data items in file */
  40.     int _data_size;                        /* size in bytes of a data item */
  41.     int _max_data;                        /* maximum data elements in ptr file */
  42.     int _data_ptr;                        /* set by last call to search() */
  43.     int _array_index;                    /* element in array foundby bssearch */
  44.     int *_ptr_array;                    /* base of pointer array */
  45. };
  46. nt random sec */